Skip to content

Implement arbitrary::Arbitrary for SmallVec - #496

Merged
alejandro-vaz merged 1 commit into
servo:v2from
Jorge-Polanco-Roque:feat/arbitrary-impl
Aug 29, 2026
Merged

Implement arbitrary::Arbitrary for SmallVec#496
alejandro-vaz merged 1 commit into
servo:v2from
Jorge-Polanco-Roque:feat/arbitrary-impl

Conversation

@Jorge-Polanco-Roque

Copy link
Copy Markdown
Contributor

Closes #494.

Ports the implementation from the v1 branch to the v2 SmallVec<T, const N> API, behind a new optional arbitrary feature (gated the same way as serde).

  • arbitrary / arbitrary_take_rest delegate to Unstructured::arbitrary_iter / arbitrary_take_rest_iter and collect via the existing FromIterator impl.
  • size_hint mirrors the standard sequence implementation.
  • Adds a feature-gated test (test_arbitrary).

Verified locally: cargo build --features arbitrary, cargo test --features arbitrary (new test passes), and cargo fmt --check are all green.

Jorge-Polanco-Roque added a commit to Jorge-Polanco-Roque/contribution-pipeline that referenced this pull request Aug 29, 2026
Afinado el pipeline para colaborar en repos reales, con tests en el sandbox y un
primer PR real abierto:

- tools/recon.sh: reconocimiento de repos (profile/find/issues/ci/t1) con veredicto
  GO/MAYBE/SKIP (≥100★), salud fina (merges/30d, externos, DCO, task-runner), y
  extracción de comandos del CI (paridad). T1 5/5 sobre repos conocidos.
- tools/pre_submit.sh: modo --parity (reproduce el CI del repo) + risk-scan del diff.
- arena/agents/referee.md: capa social (rondas de review). Contributor: sign-off +
  respetar CONTRIBUTING + declinar issues ambiguos.
- LAUNCH-PLAN.md: gaps + tests (T1–T6) + ruta gradual R0→R4 + guardrails
  (≥100★, agentes redactan / accionista publica).
- arena/CHALLENGES.md: 10 retos hyper-experto (auditoría de puntos ciegos del gate).
- LEARNINGS.md: T6 cazó una mis-selección (#9060, `[lib] test=false`) ANTES de un PR;
  re-selección verificada → contribución limpia.

Primera contribución real:
- contributions/active/C001: servo/rust-smallvec#496 — impl `arbitrary::Arbitrary`
  for `SmallVec` (closes #494). Enviado, esperando review.
- README/DASHBOARD: sección de contribuciones reales + métricas (PRs enviados 0→1).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
@alejandro-vaz
alejandro-vaz self-requested a review August 29, 2026 23:04
Comment thread Cargo.toml Outdated
Comment thread Cargo.toml Outdated
Comment thread src/lib.rs
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

also, I merged #495 before this PR, my mistake, there are now merge conflicts

simply sync your fork, fetch from v2, and your branch rebase onto it

so basically after that you have to create a tests/arbitrary.rs file with your test that on Cargo.toml is conditionally linked with the feature of arbitrary

Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
@Jorge-Polanco-Roque

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Addressed all points:

  • Rebased onto v2 (resolved the conflicts from Turn all tests into integration tests #495).
  • Moved the test to tests/arbitrary.rs, linked via [[test]] with required-features = ["arbitrary"].
  • Removed the redundant arbitrary = ["dep:arbitrary"] feature line (the optional dep already creates it).
  • Reordered the dependency.

@alejandro-vaz
alejandro-vaz added this pull request to the merge queue Aug 29, 2026
Merged via the queue into servo:v2 with commit 6645b0b Aug 29, 2026
6 checks passed
alejandro-vaz pushed a commit to alejandro-vaz/rust-smallvec that referenced this pull request Aug 30, 2026
Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
alejandro-vaz added a commit to alejandro-vaz/rust-smallvec that referenced this pull request Aug 30, 2026
* fix: refined style

* refactor: new style

* fix: style

* revert: fn single line

* Turn all tests into integration tests (servo#495)

* Implement arbitrary::Arbitrary for SmallVec (servo#496)

Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>

* docs: told agents to link to servo contributing guidelines (servo#504)

* fix: added since and note for deprecations (servo#488)

* refactor: new style

* revert: fn single line

* fix: import errors solved

* fix: formatting

* fix: style again

---------

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>
Co-authored-by: Tobias Decking <Tobias.Decking@gmail.com>
Co-authored-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
alejandro-vaz pushed a commit to alejandro-vaz/rust-smallvec that referenced this pull request Aug 30, 2026
Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
alejandro-vaz added a commit to alejandro-vaz/rust-smallvec that referenced this pull request Aug 30, 2026
* fix: refined style

* refactor: new style

* fix: style

* revert: fn single line

* Turn all tests into integration tests (servo#495)

* Implement arbitrary::Arbitrary for SmallVec (servo#496)

Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>

* docs: told agents to link to servo contributing guidelines (servo#504)

* fix: added since and note for deprecations (servo#488)

* refactor: new style

* revert: fn single line

* fix: import errors solved

* fix: formatting

* fix: style again

---------

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>
Co-authored-by: Tobias Decking <Tobias.Decking@gmail.com>
Co-authored-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
alejandro-vaz added a commit to alejandro-vaz/rust-smallvec that referenced this pull request Aug 30, 2026
* fix: cargo warnings

* Turn all tests into integration tests (servo#495)

* Implement arbitrary::Arbitrary for SmallVec (servo#496)

Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>

* docs: told agents to link to servo contributing guidelines (servo#504)

* fix: added since and note for deprecations (servo#488)

* style: updated `rustfmt.toml` guidelines (servo#490)

* fix: refined style

* refactor: new style

* fix: style

* revert: fn single line

* Turn all tests into integration tests (servo#495)

* Implement arbitrary::Arbitrary for SmallVec (servo#496)

Ports the implementation from the v1 branch to the v2 `SmallVec<T, const N>`
API, gated behind a new optional `arbitrary` feature. Delegates to
`Unstructured::arbitrary_iter` / `arbitrary_take_rest_iter` and collects via
the existing `FromIterator` impl. Adds a feature-gated test.

Closes servo#494

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>

* docs: told agents to link to servo contributing guidelines (servo#504)

* fix: added since and note for deprecations (servo#488)

* refactor: new style

* revert: fn single line

* fix: import errors solved

* fix: formatting

* fix: style again

---------

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>
Co-authored-by: Tobias Decking <Tobias.Decking@gmail.com>
Co-authored-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>

* feat: added borsh serialize (servo#486)

* feat: added borsh serialize

* fix: formatting

* fix: style formatting

---------

Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>

* feat: implement `Format` for `SmallVec` (servo#472)

* feat: added defmt for smallvec

* fix: ran formatter

* refactor: removed API boundary

* fix: ran formatter

* fix: renamed imports to avoid namespace conflicts

* refactor: simplified format for smallvec

* fix: style formatting

* fix: imports

---------

Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>

* fix: cargo warnings

---------

Signed-off-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
Signed-off-by: Alejandro Vaz <alejandro.vaz.myt@gmail.com>
Co-authored-by: Tobias Decking <Tobias.Decking@gmail.com>
Co-authored-by: Jorge Polanco <55784702+Jorge-Polanco-Roque@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement arbitrary::Arbitrary for SmallVec

2 participants